<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>websocket</title>
</head>
<body>
<script>
    <!--高级API-->
    let socket=new WebSocket('ws://localhost:3000');
    socket.onopen=function () {
        socket.send('woshi首页')
    }
    socket.onmessage=function (e) {
        console.log(e.data);
    }
</script>
</body>
</html>